import Vue from 'vue'
import VueStorage  from 'vue-ls'
import axios from 'axios';
import Cookies from 'js-cookie'

import Antd from 'ant-design-vue'
import Viser from 'viser-vue'
import 'ant-design-vue/dist/antd.less';

import Element from 'element-ui'
import './assets/styles/element-variables.scss'
//全局css样式
import '@/assets/styles/index.scss'
//自定义全局css样式
import '@/assets/styles/style.scss'
import App from './App'
import store from './store'
import router from './router'
//自定义指令
import directive from './directive'
//自定义插件
import plugins from './plugins'
//http请求封装
import { httpAction, getAction, postAction, putAction, deleteAction, downloadAction } from '@/utils/request'
//图标
import './assets/icons'
//登录校验控制
import './intercept'
//数据字典
import { getDicts } from "@/api/system/dict/data";
//系统配置
import { getConfigKey, updateConfigByKey } from "@/api/system/config";
//组件方法
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/index";
// 容器组件
import Container from "@/components/Container";
// 分页组件
import Pagination from "@/components/Pagination";
// 自定义表格工具组件
import RightToolbar from "@/components/RightToolbar"
// 富文本组件
import EditorTinymce from "@/components/EditorTinymce"
// 文件上传组件
import FileUpload from "@/components/FileUpload"
// 图片上传组件
import ImageUpload from "@/components/ImageUpload"
// 图片预览组件
import ImagePreview from "@/components/ImagePreview"
// 字典标签组件
import DictTag from '@/components/DictTag'
// 头部标签组件
import VueMeta from 'vue-meta'
// 字典数据组件
import DictData from '@/components/DictData'
// ant-design按钮组件
import AntButton from '@/components/AntDesign/Button/AntButton'
// ant-design表格组件
import AntTable from '@/components/AntDesign/Table/AntTable'
// ant-design表格操作列组件
import AntTableButtonGroup from '@/components/AntDesign/Table/AntTableButtonGroup'
// ant-design表格设置工具栏组件
import AntTableSettingTool from '@/components/AntDesign/Table/AntTableSettingTool'
// ant-design弹窗组件
import AntModal from '@/components/AntDesign/Modal/AntModal'
// ant-design树型展示组件
import AntTree from '@/components/AntDesign/Tree/AntTree'
// ant-design加载中遮罩组件
import AntSpin from '@/components/AntDesign/Spin/AntSpin'
// ant-design卡片容器组件
import AntCard from '@/components/AntDesign/Card/AntCard'
// ant-design上中下布局容器组件
import AntContainer from '@/components/AntDesign/Container/AntContainer'
// ant-design表单组件
import AntForm from '@/components/AntDesign/Form/AntForm'
// ant-design行组件
import AntRow from '@/components/AntDesign/Grid/Row/AntRow'
// ant-design列组件
import AntCol from '@/components/AntDesign/Grid/Col/AntCol'
// ant-design头部搜索条件工具栏布局组件
import AntHeaderToolbar from '@/components/AntDesign/HeaderToolBar/AntHeaderToolbar'
// ant-design表格弹窗组件
import AntModalTable from '@/components/AntDesign/Modal/AntModalTable'
// ant-design文件上传按钮组件
import AntUpload from '@/components/AntDesign/Upload/AntUpload'
// ant-design图片上传组件
import AntPicUpload from '@/components/AntDesign/Upload/AntPicUpload'
// ant-design文件上传表格组件
import AntTableUpload from '@/components/AntDesign/Upload/AntTableUpload'
// ant-design拖拽的分隔线组件
import AntMoveDivider from '@/components/AntDesign/Divider/AntMoveDivider'
// ant-design表单-级联选择下拉组件
import AntFormCascader from '@/components/AntDesign/Form/FormItem/AntFormCascader'
// ant-design表单-勾选框组件
import AntFormCheckbox from '@/components/AntDesign/Form/FormItem/AntFormCheckbox'
// ant-design表单-勾选框组组件
import AntFormCheckboxGroup from '@/components/AntDesign/Form/FormItem/AntFormCheckboxGroup'
// ant-design表单-日期选择组件
import AntFormDatePicker from '@/components/AntDesign/Form/FormItem/AntFormDatePicker'
// ant-design表单-日期范围选择组件
import AntFormDoubleDatePicker from '@/components/AntDesign/Form/FormItem/AntFormDoubleDatePicker'
// ant-design表单-通用普通输入框组件
import AntFormInput from '@/components/AntDesign/Form/FormItem/AntFormInput'
// ant-design表单-带搜索按钮的输入框组件
import AntFormInputSearch from '@/components/AntDesign/Form/FormItem/AntFormInputSearch'
// ant-design表单-月份选择组件
import AntFormMonthPicker from '@/components/AntDesign/Form/FormItem/AntFormMonthPicker'
// ant-design表单-数字类型输入组件
import AntFormNumber from '@/components/AntDesign/Form/FormItem/AntFormNumber'
// ant-design表单-多图片上传组件
import AntFormPicUpload from '@/components/AntDesign/Form/FormItem/AntFormPicUpload'
// ant-design表单-单选按钮组
import AntFormRadioGroup from '@/components/AntDesign/Form/FormItem/AntFormRadioGroup'
// ant-design表单-日期范围选择组件2
import AntFormRangePicker from '@/components/AntDesign/Form/FormItem/AntFormRangePicker'
// ant-design表单-下拉选择组件
import AntFormSelect from '@/components/AntDesign/Form/FormItem/AntFormSelect'
// ant-design表单-下拉框选择表格数据组件
import AntFormSelectTable from '@/components/AntDesign/Form/FormItem/AntFormSelectTable'
// ant-design表单-开关按钮组件
import AntFormSwitch from '@/components/AntDesign/Form/FormItem/AntFormSwitch'
// ant-design表单-文本框组件
import AntFormTextarea from '@/components/AntDesign/Form/FormItem/AntFormTextarea'
// ant-design表单-文本框组件
import AntFormTreeSelect from '@/components/AntDesign/Form/FormItem/AntFormTreeSelect'
// ant-design表单-多文件上传组件
import AntFormUpload from '@/components/AntDesign/Form/FormItem/AntFormUpload'
// ant-design表单-周选择组件
import AntFormWeekPicker from '@/components/AntDesign/Form/FormItem/AntFormWeekPicker'
// ant-design表单-年选择组件
import AntFormYearPicker from '@/components/AntDesign/Form/FormItem/AntFormYearPicker'


//表单设计器
import formDesigner from '@/components/FormDesigner/components/index'
import '@/components/FormDesigner/assets/iconfont/iconfont.js'
//粒子圆
import VueParticles from 'vue-particles'
// 全局方法挂载
Vue.prototype.$getDicts = getDicts
Vue.prototype.$getConfigKey = getConfigKey
Vue.prototype.$updateConfigByKey = updateConfigByKey
Vue.prototype.$parseTime = parseTime
Vue.prototype.$resetForm = resetForm
Vue.prototype.$addDateRange = addDateRange
Vue.prototype.$selectDictLabel = selectDictLabel
Vue.prototype.$selectDictLabels = selectDictLabels
Vue.prototype.$httpAction = httpAction
Vue.prototype.$getAction = getAction
Vue.prototype.$postAction = postAction
Vue.prototype.$putAction = putAction
Vue.prototype.$deleteAction = deleteAction
Vue.prototype.$downloadAction = downloadAction
Vue.prototype.$handleTree = handleTree
Vue.prototype.$axios = axios

// 全局组件挂载
Vue.component('DictTag', DictTag)
Vue.component('Container', Container)
Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar)
Vue.component('Editor', EditorTinymce)
Vue.component('FileUpload', FileUpload)
Vue.component('ImageUpload', ImageUpload)
Vue.component('ImagePreview', ImagePreview)
Vue.component('AntButton', AntButton)
Vue.component('AntTable', AntTable)
Vue.component('AntTableButtonGroup', AntTableButtonGroup)
Vue.component('AntTableSettingTool', AntTableSettingTool)
Vue.component('AntModal', AntModal)
Vue.component('AntTree', AntTree)
Vue.component('AntSpin', AntSpin)
Vue.component('AntCard', AntCard)
Vue.component('AntContainer', AntContainer)
Vue.component('AntForm', AntForm)
Vue.component('AntRow', AntRow)
Vue.component('AntCol', AntCol)
Vue.component('AntHeaderToolbar', AntHeaderToolbar)
Vue.component('AntModalTable', AntModalTable)
Vue.component('AntUpload', AntUpload)
Vue.component('AntPicUpload', AntPicUpload)
Vue.component('AntTableUpload', AntTableUpload)
Vue.component('AntMoveDivider', AntMoveDivider)
Vue.component('AntFormCascader', AntFormCascader)
Vue.component('AntFormCheckbox', AntFormCheckbox)
Vue.component('AntFormCheckboxGroup', AntFormCheckboxGroup)
Vue.component('AntFormDatePicker', AntFormDatePicker)
Vue.component('AntFormDoubleDatePicker', AntFormDoubleDatePicker)
Vue.component('AntFormInput', AntFormInput)
Vue.component('AntFormInputSearch', AntFormInputSearch)
Vue.component('AntFormMonthPicker', AntFormMonthPicker)
Vue.component('AntFormNumber', AntFormNumber)
Vue.component('AntFormPicUpload', AntFormPicUpload)
Vue.component('AntFormRadioGroup', AntFormRadioGroup)
Vue.component('AntFormRangePicker', AntFormRangePicker)
Vue.component('AntFormSelect', AntFormSelect)
Vue.component('AntFormSelectTable', AntFormSelectTable)
Vue.component('AntFormSwitch', AntFormSwitch)
Vue.component('AntFormTextarea', AntFormTextarea)
Vue.component('AntFormTreeSelect', AntFormTreeSelect)
Vue.component('AntFormUpload', AntFormUpload)
Vue.component('AntFormWeekPicker', AntFormWeekPicker)
Vue.component('AntFormYearPicker', AntFormYearPicker)

Vue.use(Antd)
Vue.use(Viser)
Vue.use(directive)
Vue.use(plugins)
Vue.use(VueMeta)
Vue.use(formDesigner);
Vue.use(VueParticles)
// 修改 el-dialog 默认点击遮照为不关闭
Element.Dialog.props.closeOnClickModal.default = false
Vue.use(Element, {
  size: Cookies.get('size') || 'medium' // 设置 element-ui 大小
})
//vue-ls插件本地存储配置
Vue.use(VueStorage, {
  namespace: 'vue_',   // key 键的前缀（随便起）
  name: 'ls',          // 变量名称（随便起） 使用方式：Vue.变量名称 或 this.$变量名称
  storage: 'local'     // 存储方式: session, local, memory
});
DictData.install()
//用于控制 Vue 在生产环境下是否显示提示信息。当设置为 false 时，可以阻止 Vue 在控制台输出生产模式的提示，这有助于避免在部署的应用中出现不必要的日志信息。
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
